import copy
a = [1, 2, 3, 4, ['a', 'b']]

b = a
print(a == b)
print(id(a) == id(b))
# y = copy.copy(x)  拷贝父对象，引用子对象，可变对象如list, id不一样，但值一样
c = copy.copy(a)
print(a == c)
print(id(a) == id(c))
# y = copy.deepcopy(x) 深拷贝父对象及子对象，完完全全不一样的对象object，id和值都不一样
d = copy.deepcopy(a)
print(a == d)
print(id(a) == id(d))

print("#############")
# a.append(5)
a[4].append('c')

print(a == b)
print(id(a) == id(b))

print(a == c)
print(id(a) == id(c))

print(a == d)
print(id(a) == id(d))

# a[4].append('c')
#
# print('a = ', a)
# # print('b = ', b, b == a)
# print('c = ', c)
# print('d = ', d)
# print(id(a), id(c), id(d))
# assert id(a) != id(c)
# assert id(a) != id(d)

